package com.huaxin.common.model;

import android.support.v4.util.ArrayMap;

import java.io.File;
import java.io.Serializable;

/**
 * http object
 */
public class BaseBean implements Serializable {

    private static final long serialVersionUID = 1L;
    public String beanName;// 传输对象name
    public String action;// 请求方法名字
    public String jsessionid;// jsessionid

    ArrayMap<String, File> files;
    ArrayMap<String, String> params;

    public BaseBean(String action, String jsessionid) {
        this.action = action;
        this.jsessionid = jsessionid;
    }


    public ArrayMap<String, String> getParams() {
        return params;
    }

    public ArrayMap<String, File> getFiles() {
        return files;
    }

    public BaseBean add(String name, Object val) {
        if (val instanceof File) {
            if (files == null) {
                files = new ArrayMap<>();
            }
            files.put(name, (File) val);
        } else {
            if (params == null) {
                params = new ArrayMap<>();
            }
            params.put(name, (String) val);
        }
        return this;
    }

    public String getURL() {
        return action;
    }

}
